package com.cheer.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @author cheer
 */
@Getter
@AllArgsConstructor
public enum RoleEnum {

    SUPER_ADMIN(1, "团省委"),
    SECOND_ADMIN(2, "市地团委"),
    LOWER_ADMIN(3, "下属单位团委"),
    APPLICANT(4, "申报集体");

    private final Integer code;
    private final String message;

    public static String codeToName(int code) {
        for (RoleEnum roleEnum : RoleEnum.values()) {
            if (Objects.equals(roleEnum.getCode(), code)) {
                return roleEnum.name().toUpperCase();
            }
        }
        return null;
    }
}
